import 'dart:convert';

void main() {
    var jsonString = '''
        [
            {"id": 1, "name": "a"},
            {"id": 2, "name": "b"}
        ]
    ''';
    var list = jsonDecode(jsonString);
    print(list.runtimeType.toString());/*List<dynamic>*/
    var length = list.length;
    for(var i = 0;i < length;i++){
        var item = list[i];
        print(item['id']);
        print(item['name']);
    }
    /**/
    var list2 = [
        {"id": 1, "name": "a"},
        {"id": 2, "name": "b"}
    ];
    print(jsonEncode(list2));
}